package com.kerwin.controller;

import com.kerwin.param.OrderListQueryParam;

import com.kerwin.utils.ApiResult;
import com.kerwin.vo.OrderInfoVO;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

/**
 * 案例3.1-配置项中模块和文件夹的关系
 *
 * @Author: kerwin
 * @CreateTime: 2023-02-18  16:27
 *
 */

@RestController
@RequestMapping("/test3")
@Slf4j
public class Test3Controller {

    /**
     *
     * 案例3.1-不写@folder的接口
     * @return
     */
    @GetMapping("/test1")
    public ApiResult<List<OrderInfoVO>> list(OrderListQueryParam param){
        OrderInfoVO orderInfoVO = new OrderInfoVO();
        orderInfoVO.setOId(param.getOId());
        orderInfoVO.setPName(param.getPName());
        ArrayList<OrderInfoVO> orderInfoVOS = new ArrayList<>();
        return ApiResult.ok(orderInfoVOS);
    }

    /**
     * 案例3.1-使用一级@folder的接口
     * @folder 案例3.1-使用(@folder 使用接口)后的位置
     * @status deprecated
     * @return
     */
    @GetMapping("/test2")
    public ApiResult<List<OrderInfoVO>> list(@RequestParam(name = "pId") Long pId,@RequestParam(name = "oId") Long oId,@RequestParam(name = "pName") String pName,
                                             @RequestParam(name = "pageNum",defaultValue = "1") Integer pageNum,@RequestParam(name = "pageSize",defaultValue = "10") Integer pageSize){
        OrderInfoVO orderInfoVO = new OrderInfoVO();
        orderInfoVO.setPId(pId);
        orderInfoVO.setOId(oId);
        orderInfoVO.setPName(pName);
        ArrayList<OrderInfoVO> orderInfoVOS = new ArrayList<>();
        return ApiResult.ok(orderInfoVOS);
    }






}
